package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.antlr.v4.runtime.misc.NotNull;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.ExpressionBetweenMaxValueContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.ExpressionBetweenMinValueContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.IdentifierNotContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.ExpressionBetweenContext;

/**
 * between 表达式的遍历
 * 
 * @author zwd
 *
 */
public class ExpressionBetweenVisitor extends AbsCQLParserBaseVisitor<ExpressionBetweenContext> {

	private ExpressionBetweenContext context = null;

	public ExpressionBetweenVisitor() {
		context = new ExpressionBetweenContext();
	}

	@Override
	protected ExpressionBetweenContext defaultResult() {
		return context;
	}

	@Override
	public ExpressionBetweenContext visitIdentifierNot(@NotNull IdentifierNotContext ctx) {
		context.setNot(true);
		return context;
	}

	@Override
	public ExpressionBetweenContext visitExpressionBetweenMaxValue(@NotNull ExpressionBetweenMaxValueContext ctx) {
		ExpressionBetweenMaxValueVisitor visitor = new ExpressionBetweenMaxValueVisitor();
		context.setMaxValue(visitor.visit(ctx));
		return context;
	}

	@Override
	public ExpressionBetweenContext visitExpressionBetweenMinValue(@NotNull ExpressionBetweenMinValueContext ctx) {
		ExpressionBetweenMinValueVisitor visitor = new ExpressionBetweenMinValueVisitor();
		context.setMinValue(visitor.visit(ctx));
		return context;
	}

}
